package everyday;

import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;

/**
 * @Author: Siantar
 * @Date: 2023-07-08-20:02
 * @Description: 1.0
 */
public class T0167 {
    public int[] twoSum(int[] numbers, int target) {
        int left = 0, right = 1;
        while (right < numbers.length && numbers[left] + numbers[right] <= target) {
            right++;
        }
        right--;
        while (numbers[left] + numbers[right] != target) {
            if (numbers[left] + numbers[right] < target) {
                left++;
            } else {
                right--;
            }
        }
        return new int[]{left + 1, right + 1};
    }
}
